<%@ page language="java" import="java.util.*" pageEncoding="utf-8" import="java.util.*,listen.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body> 
	<div>
		<h3 align="left">当前在线用户:${applicationScope.number}人</h3>
		<table border="1" cellspacing="0"> 
			<tr>
				<td>id</td>
				<td>ip</td>
				<td>firstTime</td>
			</tr>
			<%-- <c:choose> 
  				<c:when test=" ${not empty userList }" > 
  					<c:forEach var="list" items="${applicationScope.userList }"> 
 						<tr> 
  							<td>${list.ssessionIdString }</td> 
 							<td>${list.ipString }</td> 
 							<td>${list.firsttTimeString }</td> 
 						</tr> 
 					</c:forEach> 
  				</c:when> 
  				<c:otherwise> 
 					<tr> 
  						<td colspan="3">无在线用户</td> 
  					</tr> 
  				</c:otherwise> 
 				</c:choose> --%> 
			<%ArrayList<User>  userList =  (ArrayList<User>)request.getServletContext().getAttribute("userList");  
				if(userList!=null){ 
					for(User u:userList){ 
						%>
						<tr>
							<td><%=u.getSessionIdString() %> </td>
							<td><%=u.getIpString() %></td>
						<td><%=u.getFirsttTimeString() %></td>
					</tr>
			<%}}%>
		</table>
	</div>
</body> 

</html>
